-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Automatic python bindings with cppyy #145
base: main
Are you sure you want to change the base?
Conversation
So the main problem with this PR is that the code doesn't build automatically... I get build errors when I install through spack, but when I just copy and paste the failed commands into command line, the code compiles and the python bindings work. I've put detailed instructions of the process I go through to get it to build in |
``` | ||
spack: | ||
specs: | ||
- neso%[email protected] ^openblas ^hipsycl ^scotch@6 ^[email protected] ^[email protected]%[email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end we'll want to have a spec per build, so something like
- neso%[email protected] ^openblas ^[email protected]%[email protected] ^scotch@6 ^[email protected]%[email protected] ^[email protected]%[email protected] ^clang
Preferably with a set of allowable clangs and gccs.
Wayne has told me this needs review. It's still marked as WIP. Should that label be removed? Or are there a few final changes needed prior to review? |
Hi @cmacmackin, I've stopped making changes and I'd like someone to have a look at it, but I know it's not in a state to get merged. Like I describe above, the actual build commands seem to work in isolation, but not when executed via the cmake script. To get some input on fixing the cmake would be great! |
OK, I can give it a go. I've never used cppyy before, so might take a bit of trial and error for me to figure it out and get the hang of it. |
Before I tried building the bindings I wanted to ensure I could build NESO properly with Clang. In the process of this I discovered that a regressions have been introduced and the test suite no longer passes for any of the compilers. |
@@ -17,7 +17,8 @@ class Mesh; | |||
|
|||
class Mesh { | |||
public: | |||
Mesh(int nintervals = 10, double dt = 0.1, int nt = 1000); | |||
Mesh(); | |||
Mesh(int nintervals, double dt = 0.1, int nt = 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes regressions. There were previously calls made to the Mesh()
constructor with no arguments, expecting it to be equivalent to a call of Mesh(10, 0.1, 1000)
. However, now it will call your newly-defined default constructor, which uses a different value for nintervals_in
and doesn't perform any of the setup done in the body of the original constructor.
@@ -14,6 +14,8 @@ class Species; | |||
|
|||
class Species { | |||
public: | |||
Species(); // unused but required by cppyy python bindings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be causing the integration test Electrostatic2D3V.TwoStream
to fail. Not entirely sure why that would happen, but when I comment it out the test passes.
Description
cppyy provides automatic python bindings for C++ functions. This allows us to call NESO functions from python scripts, which has the following advantages:
This PR adds:
spack.yaml
andrequirements.txt
to add dependenciesCMakeLists.txt
to build the python bindingscppyy_run.py
which executes the same program assrc/main.cpp
, but from pythonREADME_cppyy.md
that gives instructions on how to build and run, and outlines problems I'm having with the build systemType of change
Testing
Please describe the tests that you ran to verify your changes and provide instructions for reproducibility. Please also list any relevant details for your test configuration.
cppyy_run.py
replicates the output ofsrc/main.cpp
Test Configuration:
Checklist:
cmake
clang-format
against my*.hpp
and*.cpp
changescmake-format
against my changes toCMakeLists.txt
black
against changes to*.py